package com.zimu.example.controller;

import com.blade.mvc.annotation.GetRoute;
import com.blade.mvc.annotation.Param;
import com.blade.mvc.annotation.Path;
import com.blade.mvc.annotation.PostRoute;
import com.blade.mvc.http.Request;
import com.blade.mvc.http.Response;
import com.blade.mvc.ui.ModelAndView;

/**
 * @author : zimu
 * @Date: 2018/7/19 14:16
 * @description : login
 */
@Path
public class LoginController {
    @PostRoute("/login")
    public void login(Request request, Response response){
        String username = request.query("username", "admin");
        String password = request.query("password", "password");
        response.html("<h1>"+username+"</h1>"+"<br><h1>"+password+"</h1>");
    }
    @GetRoute("register")
    public ModelAndView register(ModelAndView modelAndView){
        modelAndView.setView("register.html");
        return modelAndView;
    }
//    @GetRoute("/login")
//    public void login(Request request, Response response){
//        String name = request.query("username", "defalut");
//        String password = request.query("password", "none");
//        response.html("your name is :" + name +" . your password is :" +password);
//    }
}
